package com.niit.servlet;

import com.niit.domain.Classification;
import com.niit.service.IClassificationService;
import com.niit.service.impl.ClassificationServiceImpl;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import javax.swing.text.html.HTML;
import java.io.IOException;
import java.util.List;

@WebServlet(name = "ClassificationServlet", value = "/ClassificationServlet")
public class ClassificationServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        IClassificationService ics=new ClassificationServiceImpl();
        List<Classification> classificationList=ics.queryService();
        //将list集合放进session域
        HttpSession claSession=request.getSession();
        claSession.setAttribute("classificationList",classificationList);
        response.sendRedirect("index.jsp");
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }
}
